package com.xbongbong.paas.business.rule;

import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.pro.form.pojo.dto.DeleteBusinessRuleInfoDTO;
import com.xbongbong.pro.form.pojo.dto.EnableBusinessRuleInfoDTO;
import com.xbongbong.pro.form.pojo.dto.FormUpdateBusinessRuleDTO;
import com.xbongbong.pro.form.pojo.dto.SortBusinessRuleInfoDTO;
import com.xbongbong.pro.form.pojo.vo.DeleteBusinessRuleInfoVO;
import com.xbongbong.pro.form.pojo.vo.EnableBusinessRuleInfoVO;
import com.xbongbong.pro.form.pojo.vo.FormBusinessRuleVO;
import com.xbongbong.pro.form.pojo.vo.FormUpdateBusinessRuleVO;
import com.xbongbong.pro.form.pojo.vo.SortBusinessRuleInfoVO;

import java.util.List;

/**
 * @author 吴峰
 * @version v1.0
 * @date 2020/6/9 20:03
 * @since v1.0
 */
public interface BusinessRuleInfoService {

    /**
     * 获取业务规则
     * @param corpid
     * @param formId
     * @param businessType
     * @param saasMark
     * @param searchFormName 1：搜索表单名称
     * @return
     * @throws XbbException
     */
    FormBusinessRuleVO get(String corpid, Long formId, Integer businessType, Integer saasMark, Integer searchFormName) throws XbbException;

    /**
     * 将tb_paas_form中的business_rules转化到表tb_business_rule_info中
     * @param corpid
     * @throws XbbException
     */
    void setBusinessRule(List<String> corpid) throws XbbException;
    /**
     * 保存
     * @param formUpdateBusinessRuleDTO
     * @return com.xbongbong.pro.form.pojo.vo.FormUpdateBusinessRuleVO
     * @author 吴峰
     * @date 2021/6/9 16:41
     * @throws XbbException
     */
    FormUpdateBusinessRuleVO save(FormUpdateBusinessRuleDTO formUpdateBusinessRuleDTO) throws XbbException;
    /**
     * 删除
     * @param deleteBusinessRuleInfoDTO
     * @return com.xbongbong.pro.form.pojo.vo.DeleteBusinessRuleInfoVO
     * @author 吴峰
     * @date 2021/6/9 16:41
     * @throws XbbException
     */
    DeleteBusinessRuleInfoVO delete(DeleteBusinessRuleInfoDTO deleteBusinessRuleInfoDTO) throws XbbException;

    /**
     * 排序
     * @param sortBusinessRuleInfoDTO
     * @return com.xbongbong.pro.form.pojo.vo.SortBusinessRuleInfoVO
     * @author 吴峰
     * @date 2021/6/9 16:41
     * @throws XbbException
     */
    SortBusinessRuleInfoVO sort(SortBusinessRuleInfoDTO sortBusinessRuleInfoDTO) throws XbbException;

    /**
     * 启用/关闭
     * @param sortBusinessRuleInfoDTO
     * @return com.xbongbong.pro.form.pojo.vo.EnableBusinessRuleInfoVO
     * @author 吴峰
     * @date 2021/6/9 16:41
     * @throws XbbException
     */
    EnableBusinessRuleInfoVO enable(EnableBusinessRuleInfoDTO sortBusinessRuleInfoDTO) throws XbbException;

    /**
     * 删除表单，校验下业务规则是否存在
     * @param corpid
     * @param formId
     * @param businessType
     * @return
     * @throws XbbException
     */
    Integer validateBusinessRules(String corpid, Long formId, Integer businessType) throws XbbException;


}
